/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package controlacciones.ejb3.dao.entity;

import controlacciones.ejb3.entity.TbArea;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Vanessa
 */

@Stateless
public class TbAreaFacade implements TbAreaFacadeLocal {
    @PersistenceContext(unitName="ControlAccionesComercial_EAR-ejbPU")
    private EntityManager em;

    public void create(TbArea tbArea) {
        em.persist(tbArea);
    }

    public void edit(TbArea tbArea) {
        em.merge(tbArea);
    }

    public void remove(TbArea tbArea) {
        em.remove(em.merge(tbArea));
    }

    public TbArea find(Object id) {
        return em.find(TbArea.class, id);
    }

    public List<TbArea> findAll() {
        return em.createQuery("select object(o) from TbArea as o").getResultList();
    }
}
